package com.yidu.qianfeng.track_fu;

import com.yidu.qianfeng.common.bean.transport.TrackWaybill;
import com.yidu.qianfeng.common.util.JsonMsgUtil;
import com.yidu.qianfeng.service.TrackWaybillService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @Author: 符鑫俊
 * @Description: 跟踪记录控制器，增删改
 * @Date Created in 9:33 2021/4/21
 * @since 1.0
 */
public class TrackFuController {

    //注入跟踪业务实现
    @Resource(name = "trackWaybillServiceImpl")
    private TrackWaybillService trackWaybillService;

    /**
     * 新增跟踪
     * @param trackWaybill 跟踪实体对象
     * @return 结果
     */
    @RequestMapping("/addTrack")
    public @ResponseBody
    String addTrack(@RequestBody TrackWaybill trackWaybill){

        return trackWaybillService.addTrack(trackWaybill);
    }

    /**
     *  删除跟踪记录
     * @param trackId 跟踪记录id
     * @return 删除结果
     */
    @RequestMapping("/deleteTrack")
    public @ResponseBody String deleteTrack(@RequestParam("trackId") String trackId){
        return trackWaybillService.deleteTrack(trackId);
    }

    /**
     * 修改跟踪记录
     * @param track 带id的跟踪记录实体
     * @return 修改结果
     */
    @RequestMapping("/updateTrackById")
    public @ResponseBody String updateTrackById(@RequestBody TrackWaybill track){
        return trackWaybillService.updateTrackById(track);
    }




}
